-
Notifications
You must be signed in to change notification settings - Fork 312
feat(iroh): introduce endpoint presets #3523
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Documentation for this PR has been generated and is available at: https://n0-computer.github.io/iroh/pr/3523/docs/iroh/ Last updated: 2025-10-17T08:25:55Z |
| /// Defines a preset | ||
| pub trait Preset { | ||
| /// Applies the configuration to the passed in [`Builder`]. | ||
| fn apply(self, builder: Builder) -> Builder; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason for preset to take self and not &self?
Imagine you had a complex preset, you would have to clone it to apply it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing specific, I was just expecting them to be use once only
9cbb73b to
bc79613
Compare
30b8edd to
2dc47ed
Compare
2dc47ed to
13970a2
Compare
|
Hey, so I pushed a commit that includes removing If I've misunderstood the purpose of a test feel free to revert or change. |
|
Two concerns about this PR:
The first issue is just about communicate, and I think folks will just get used to it. The second one I'm more concerned about because it's easy to just not realize what you are doing. This may also be solved a bit by documentation (for example, in the I think we need a bit of an answer around the second point before we can merge. We can decide it's enough to just communicate this through docs, or we can decide that's too big of a foot-gun and need to change some things, or we can decide it doesn't actually matter, or some other fourth option. One general thought:
Just a thought! |
Co-authored-by: ramfox <[email protected]>
|
@ramfox I have pushed a version that enforces choosing a |
Description
Closes #3470
Breaking Changes
iroh::endpoint::Builder::n0_discoveryiroh::endpoint::Builder::discovery_dhtiroh::endpoint::Builder::discovery_local_networkiroh::endpoint::Builder::discoveryiroh::discovery::DiscoveryContextiroh::endpoint::Builder::defaultiroh::Endpoint::bind- this allows to immediately create anEndpointwith the defaults and binds itiroh::endpoint::Endpoint::empty_builderiroh::endpoint::presets- new module, defining a trait on how to preconfigure andEndpointiroh::endpoint::Builder::new- creates a new builder with theN0presetiroh::endpoint::Builder::presetiroh::endpoint::Builder::empty- creates a new builder, completely empty (no discovery, no relay map)iroh::'Endpoint::add_discoveryis now called justdiscoveryiroh::discovery::IntoDiscoverynow takes anEndpointinstead of aDiscoveryContext